package me.baicai.modules.belldandy.gcb.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import java.io.Serializable;

/**
* @author 超级大白菜
* @date 2020-04-01
*/
@Entity
@Data
@Table(name="user_project")
@IdClass(UserProject.class)
public class UserProject implements Serializable {

    // 用户ID
    @Id
    @Column(name = "uid")
    private Long uid;

    // 项目ID
    @Id
    @Column(name = "pid")
    private Integer pid;

    // 提成百分比
    @Column(name = "commission",nullable = false)
    private Double commission;

    // 提成百分比
    @Column(name = "type",nullable = false)
    private String type;

    public void copy(UserProject source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
